<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Register</title>
		<meta name="viewport" content="width=1280, user-scalable=no"/>  
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <script src="./jquery.min.js" type="text/javascript"></script>
	</head>
<?
//conect to mysql
$db = mysql_connect("localhost", "usr_2012_16", "se09member");
if (!$db) {
	print "Error - Could not connect to MySQL";
	exit;
}
// Select the guest
$er = mysql_select_db("db_2012_16");
if (!$er) {
	print "Error - Could not select the database db_2012_16";
	exit;
}
$query = "insert into se_user values(0,'$email', '". md5($password)."', '$nick_name', 0, 0, 1);";
// Execute the query
$result = mysql_query($query);
if (!$result) {
	print "Error - the query could not be executed";
	$error = mysql_error();
	print "<p>" . $error . "</p>";
	exit;
}
?>
	<body>        
        <script>
            var f = $('<form action="login.php" method="post">');
            f.html('<input type="hidden" name="email" value="<? echo $email ?>" /><input type="hidden" name="password" value="<? echo $password ?>" />');
            f.submit();
        </script>
	</body>
</html>

